<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>
    <script src="layer/layer.js"></script>
</head>
<body>
    <div class="panel admin-panel">
        <div class="panel-head"><strong> 子管理员信息</strong></div>
        <div class="body-content">
            <div class="form-x">
                <div class="form-group">
                    <div class="label">
                        <label for="sitename">账户：</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input w50"  name="name" id="name" size="50" data-validate="required:请输入子管理员账号,repeat#password:"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label for="sitename">密码：</label>
                    </div>
                    <div class="field">
                        <input type="text" class="input w50"  name="password" id="password"  size="50" data-validate="required:请输入子管理员密码,repeat#password:"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label for="sitename">所属快递点	：</label>
                    </div>
                    <div class="field">
                        <select id="type" class="input w50" name="expresspoint" id="expresspoint">
                            {volist name='list' id='vo'}
                            <option value="{$vo.sitename}" selected>{$vo.sitename}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <div class="label">
                        <label for="sitename">权限	：</label>
                    </div>
                    <div class="field">
                        <select id="type" class="input w50" name="jurisdiction" id="jurisdiction">
                            <option value="0" selected>无权限</option>
                            <option value="1" >员工管理员</option>
                            <option value="2" >快递管理员</option>
                            <option value="3" >站点管理员</option>
                        </select>
                    </div>
                </div>
                </div>



            </div>
                <center><button class="button bg-main icon-check-square-o" onclick="member_insert()"> 提交</button>   </center>
            </div>
        </div>
    </div>
</body>
<script>
    function member_insert() {
        var name = $('#name').val();
        //var name = $(" input[ name='name' ] ").val();
        var password = $('#password').val();
        //var password = $(" input[ name='password' ] ").val();
        var expresspoint = $('#expresspoint').val();
        //var expresspoint = $(" input[ name='expresspoint' ] ").val();
        var jurisdiction = $('#jurisdiction').val();
        //var jurisdiction = $(" input[ name='jurisdiction' ] ").val();
        if (name == "") {
            alert('账号不能为空');
            return false;
        }
        if (password == "") {
            alert('密码不能为空');
            return false;
        }
        if (expresspoint == "") {
            alert('所属快递点不能为空');
            return false;
        }
        if (jurisdiction == "jurisdiction") {
            alert('管理权限不能为空');
            return false;
        }
        $.ajax({
            url: "adminadd",
            type: "POST",
            data: {"name":name,"password":password,"expresspoint":expresspoint,"jurisdiction":jurisdiction},
            dataType: "json",
            //success 会在成功接收到返回数据后触发
            success:function (re) {
                if(re.code == 1){
                    layer.alert('添加成功',function () {
                        location.href="admin";
                    });
                }
                if(re.code == 2){
                    layer.alert('添加重复');
                }
                if(re.code == 3){
                    layer.alert('添加失败');
                }
            }
        });
    }

</script>
</html>